//
//  ShequTableViewCell.m
//  维度科技
//
//  Created by 谷银行 on 2019/1/23.
//  Copyright © 2019 谷银行. All rights reserved.
//

#import "ShequTableViewCell.h"

@implementation ShequTableViewCell
-(UIImageView *)img{
    if (!_img) {
        _img=[[UIImageView alloc] init];
        _img.layer.masksToBounds=YES;
        _img.layer.cornerRadius=25;
        _img.image=[UIImage imageNamed:@"h1"];
    }
    return _img;
}
-(UILabel *)Zhuname{
    if (!_Zhuname) {
        _Zhuname=[[UILabel alloc] init];
        _Zhuname.text=@"球事";
    }
    return _Zhuname;
}
-(UILabel *)Timer{
    if (!_Timer) {
        _Timer=[[UILabel alloc] init];
        _Timer.text=@"3分钟前";
        _Timer.textColor=[UIColor lightGrayColor];
    }
    return _Timer;
}
-(UILabel *)Fubiaoti{
    if (!_Fubiaoti) {
        _Fubiaoti=[[UILabel alloc] init];
        _Fubiaoti.text=@"我只关心足球篮球NBA";
        _Fubiaoti.textColor=[UIColor lightGrayColor];
    }
    return _Fubiaoti;
}
-(UILabel *)label1{
    if (!_label1) {
        _label1=[[UILabel alloc] init];
        _label1.text=@"特里退役:我的心永远属于切尔西";
        _label1.textColor=[UIColor lightGrayColor];
    }
    return _label1;
}
-(UILabel *)label2{
    if (!_label2) {
        _label2=[[UILabel alloc] init];
        _label2.text=@"前切尔西和英格兰队长约翰.特里今晨通过社交媒体宣布37岁的,他结束职业足球运动员生涯.退役后,特里希望能成为一名教练";
        _label2.textColor=[UIColor lightGrayColor];
        _label2.numberOfLines = 0;
    }
    return _label2;
}
-(UIButton *)QuanWen{
    if (!_QuanWen) {
        _QuanWen=[[UIButton alloc] init];
        
    }
    return _QuanWen;
}
-(UIImageView *)img1{
    if (!_img1) {
        _img1=[[UIImageView alloc] init];
        _img1.image=[UIImage imageNamed:@"h1"];
        
    }
    return _img1;
}
-(UIImageView *)img2{
    if (!_img2) {
        _img2=[[UIImageView alloc] init];
        _img2.image=[UIImage imageNamed:@"h2"];
    }
    return _img2;
}
-(UIButton *)Ping{
    if (!_Ping) {
        _Ping=[[UIButton alloc] init];
        [_Ping setBackgroundImage:[UIImage imageNamed:@"common_icon_comment_n_hdpi"] forState:UIControlStateNormal];
        [_Ping addTarget:self action:@selector(pinbtn:) forControlEvents:UIControlEventTouchUpInside];
        
        _vie=[[UIView alloc] initWithFrame:CGRectMake(0, 390,150, 370)];
        _vie.backgroundColor=[UIColor lightGrayColor];
        UILabel *label=[[UILabel alloc] initWithFrame:CGRectMake(20, 10, 300, 40)];
        label.text=@"何马  我的心永远属于切西尔";
        [_vie addSubview:label];
        
        UILabel *label1=[[UILabel alloc] initWithFrame:CGRectMake(20, 50, 300, 40)];
        label1.text=@"贪睡春天  似有所指哈哈哈";
        [_vie addSubview:label1];
        
        UILabel *label2=[[UILabel alloc] initWithFrame:CGRectMake(20, 90, 300, 40)];
        label2.text=@"阿服  特里加油!";
        [_vie addSubview:label2];
        
        UIButton *btn=[[UIButton alloc] initWithFrame:CGRectMake(100, 110, 200, 40)];
        [btn setTitle:@"点击查看更多评论" forState:UIControlStateNormal];
        [btn setTitleColor:[UIColor cyanColor] forState:UIControlStateNormal];
        [_vie addSubview:btn];
        
        
        _vie.hidden=YES;
        [_Ping addSubview:_vie];
        
        NSLog(@"111");
    }
    return _Ping;
}
-(void)pinbtn:(UIButton *)btn{
    if (_Ping.selected==YES) {
        _vie.hidden=YES;
        _Ping.selected=NO;
    }else{
        _vie.hidden=NO;
        _Ping.selected=YES;
    }
}
-(UILabel *)P1{
    if (!_P1) {
        _P1=[[UILabel alloc] init];
        _P1.text=@"467";
        _P1.textColor=[UIColor lightGrayColor];
    }
    return _P1;
}
-(UIButton *)Zan{
    if (!_Zan) {
        _Zan=[[UIButton alloc] init];
        [_Zan addTarget:self action:@selector(zanbtn:) forControlEvents:UIControlEventTouchUpInside];
        [_Zan setImage:[UIImage imageNamed:@"common_icon_prise_n_hdpi"] forState:UIControlStateNormal];
        [_Zan setImage:[UIImage imageNamed:@"common_icon_praise_s_hdpi"] forState:UIControlStateSelected];
    }
    return _Zan;
}
-(void)zanbtn:(UIButton *)btn{
    _Zan.selected=!_Zan.selected;
    NSLog(@"点赞成功!");
}
-(UILabel *)Z1{
    if (!_Z1) {
        _Z1=[[UILabel alloc] init];
        _Z1.text=@"1000";
        _Z1.textColor=[UIColor lightGrayColor];
    }
    return _Z1;
}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self addSubview:self.img];
        [self addSubview:self.Zhuname];
        [self addSubview:self.Timer];
        [self addSubview:self.Fubiaoti];
        [self addSubview:self.label1];
        [self addSubview:self.label2];
        [self addSubview:self.QuanWen];
        [self addSubview:self.img1];
        [self addSubview:self.img2];
        [self addSubview:self.Ping];
        [self addSubview:self.vie];
        [self addSubview:self.P1];
        [self addSubview:self.Zan];
        [self addSubview:self.Z1];
        [self Sd_atuol];
    }
    return self;
}
- (void)Sd_atuol{
    // t头像
    _img.sd_layout
    .topSpaceToView(self, 10)
    .leftSpaceToView(self, 10)
    .heightIs(50)
    .widthIs(50);
    // 网名
    _Zhuname.sd_layout
    .topSpaceToView(self, 10)
    .leftSpaceToView(self.img, 10)
    .heightIs(30);
    //时间
    _Timer.sd_layout
    .topSpaceToView(self, 10)
    .leftSpaceToView(self.Zhuname, 10)
    .heightIs(30)
    .widthIs(100);
    //介绍
    _Fubiaoti.sd_layout
    .topSpaceToView(self.Zhuname, 0)
    .leftSpaceToView(self.img, 10)
    .heightIs(30)
    .widthIs(200);
    //小标题
    _label1.sd_layout
    .topSpaceToView(self.img, 10)
    .leftSpaceToView(self, 10)
    .heightIs(30)
    .widthIs(300);
    //内容
    _label2.sd_layout
    .topSpaceToView(self.label1, 20)
    .leftSpaceToView(self, 10)
    .heightIs(80)
    .widthIs(397);
    //全文
    
    
    //双照片
    _img1.sd_layout
    .topSpaceToView(self.label2, 20)
    .leftSpaceToView(self, 10)
    .heightIs(100)
    .widthIs(100);
    
    _img2.sd_layout
    .topSpaceToView(self.label2, 20)
    .leftSpaceToView(self.img1, 10)
    .heightIs(100)
    .widthIs(100);
    
    //留言
    _Ping.sd_layout
    .topSpaceToView(self, 360)
    .leftSpaceToView(self, 200)
    .heightIs(20)
    .widthIs(20);
    
    //留言下拉
    _vie.sd_layout
    .topSpaceToView(self, 390)
    .leftSpaceToView(self, 20)
    .heightIs(150)
    .widthIs(370);
    
    //留言个数
    _P1.sd_layout
    .topSpaceToView(self, 360)
    .leftSpaceToView(self.Ping, 5)
    .heightIs(20)
    .widthIs(80);
    //点赞
    _Zan.sd_layout
    .topSpaceToView(self, 360)
    .leftSpaceToView(self.P1, 10)
    .heightIs(20)
    .widthIs(20);
    //点赞个数
    _Z1.sd_layout
    .topSpaceToView(self, 360)
    .leftSpaceToView(self.Zan, 5)
    .heightIs(20)
    .widthIs(80);
    
    
}
@end
